<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AlbumPic extends Model
{

    protected $table = 'albumpic';

    protected $primaryKey = 'ap_id';

    public $timestamps = false;
    //白名单
    protected $fillable = [
        'ap_id', //主键ID
        'ac_id', //相册ID
        'ap_url', //相片路径
        'create_time', //存储时间
        'ap_name', //相片名称
        'audit', //审核
        'is_del', //是否删除
        'ap_url_oss',
    ];

    protected $casts = ['ap_url'];

    public function getApUrlAttribute($value)
    {
        return \App\Library\HandleFile::handleFilePath($value, $this->ap_url_oss);
    }

    public function album_class()
    {
        return $this->hasOne('App\\Models\\AlbumClass', 'ac_id', 'ac_id');
    }
}
